/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.scm.rmpm.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 *
 * @author Kenn
 */
@Entity
public class PurchasePlan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    private Timestamp dateCreated;
    private Timestamp datePurchasePlan;
    private Boolean currency;
    private Boolean urgent;
    @OneToMany (targetEntity = RawMaterialPurchaseOrder.class, cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
    private Collection<RawMaterialPurchaseOrder> rmpos;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Timestamp getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Timestamp dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Collection<RawMaterialPurchaseOrder> getRmpos() {
        return rmpos;
    }

    public void setRmpos(Collection<RawMaterialPurchaseOrder> rmpos) {
        this.rmpos = rmpos;
    }

    public Boolean getCurrency() {
        return currency;
    }

    public void setCurrency(Boolean currency) {
        this.currency = currency;
    }

    public Boolean getUrgent() {
        return urgent;
    }

    public void setUrgent(Boolean urgent) {
        this.urgent = urgent;
    }

    public Timestamp getDatePurchasePlan() {
        return datePurchasePlan;
    }

    public void setDatePurchasePlan(Timestamp datePurchasePlan) {
        this.datePurchasePlan = datePurchasePlan;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PurchasePlan)) {
            return false;
        }
        PurchasePlan other = (PurchasePlan) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "merlion.scm.rmpm.entity.PurchasePlan[ id=" + id + " ]";
    }
    
}
